/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GerenciarLabs.java
 *
 * Created on Jul 18, 2011, 1:38:51 AM
 */

package janelas;

import classes.Equipamento;
import classes.Laboratorio;
import db.EquipDAO;
import db.LabDAO;
import db.LocalDAO;
import db.ReservaDAO;
import db.TipoLabDAO;
import java.awt.Component;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import projetofinaltecnicas.Main;

/**
 * 
 * @author Matheus Freire
 */
public class GerenciarLabs extends javax.swing.JPanel {

    int idLab;
    String[] tabela = new String[5];
    String[] eqp = new String[2];
    String frase;

    String idioma;
    String usuario;
    /** Creates new form GerenciarLabs */
    public GerenciarLabs(String idioma, String usuario) {
        initComponents();

        this.idioma = idioma;
        this.usuario = usuario;

        addTipoLab.setVisible(false);

        internacionaliza();
        organizarHeaderLabs();
        organizarHeaderEquip();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        poplab = new javax.swing.JPopupMenu();
        inserirLab = new javax.swing.JMenuItem();
        editarLab = new javax.swing.JMenuItem();
        removerLab = new javax.swing.JMenuItem();
        equip = new javax.swing.JMenuItem();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tabelalab = new javax.swing.JTable();
        titulo = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        juser = new javax.swing.JLabel();
        jiduser = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jRemover = new javax.swing.JButton();
        jEditar = new javax.swing.JButton();
        jInserir = new javax.swing.JButton();
        jLocal = new javax.swing.JLabel();
        jTipo = new javax.swing.JLabel();
        local = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        idlab = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        tabelaequip = new javax.swing.JTable();
        jScrollPane4 = new javax.swing.JScrollPane();
        tabelaequip1 = new javax.swing.JTable();
        jEquip = new javax.swing.JLabel();
        jEquipD = new javax.swing.JLabel();
        adicionar = new javax.swing.JButton();
        remover = new javax.swing.JButton();
        tipo = new javax.swing.JComboBox();
        nbancada = new javax.swing.JTextField();
        jPBancada = new javax.swing.JLabel();
        jNBancada = new javax.swing.JLabel();
        pbancada = new javax.swing.JTextField();
        addTipoLab = new javax.swing.JButton();

        inserirLab.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/pencil_add.png"))); // NOI18N
        inserirLab.setText("Inserir");
        inserirLab.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                inserirLabActionPerformed(evt);
            }
        });
        poplab.add(inserirLab);

        editarLab.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/pencil.png"))); // NOI18N
        editarLab.setText("Editar");
        editarLab.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editarLabActionPerformed(evt);
            }
        });
        poplab.add(editarLab);

        removerLab.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/delete.png"))); // NOI18N
        removerLab.setText("Remover");
        removerLab.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removerLabActionPerformed(evt);
            }
        });
        poplab.add(removerLab);

        equip.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/monitor.png"))); // NOI18N
        equip.setText("Equipamentos");
        equip.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                equipActionPerformed(evt);
            }
        });
        poplab.add(equip);

        setMinimumSize(new java.awt.Dimension(776, 552));
        setSize(new java.awt.Dimension(776, 552));

        jPanel1.setMinimumSize(new java.awt.Dimension(776, 552));
        jPanel1.setSize(new java.awt.Dimension(776, 552));
        jPanel1.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jPanel1formComponentShown(evt);
            }
        });
        jPanel1.addContainerListener(new java.awt.event.ContainerAdapter() {
            public void componentAdded(java.awt.event.ContainerEvent evt) {
                jPanel1formComponentAdded(evt);
            }
        });

        tabelalab.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "ID", "N Por Bancada", "N Bancadas", "Local", "TIpo"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tabelalab.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        tabelalab.setShowGrid(true);
        tabelalab.setShowHorizontalLines(false);
        tabelalab.getTableHeader().setReorderingAllowed(false);
        tabelalab.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabelalabMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tabelalab);
        tabelalab.getColumnModel().getColumn(0).setResizable(false);
        tabelalab.getColumnModel().getColumn(1).setResizable(false);
        tabelalab.getColumnModel().getColumn(2).setResizable(false);
        tabelalab.getColumnModel().getColumn(3).setResizable(false);
        tabelalab.getColumnModel().getColumn(4).setResizable(false);

        titulo.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        titulo.setText("Gerenciar Laboratorios");

        juser.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        juser.setText("Usuário");

        jiduser.setText("ID User");

        jRemover.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/delete.png"))); // NOI18N
        jRemover.setText("Remover");
        jRemover.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRemoverActionPerformed(evt);
            }
        });

        jEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/pencil.png"))); // NOI18N
        jEditar.setText("Editar");
        jEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jEditarActionPerformed(evt);
            }
        });

        jInserir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/pencil_add.png"))); // NOI18N
        jInserir.setText("Inserir");
        jInserir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jInserirActionPerformed(evt);
            }
        });

        jLocal.setText("Local");

        jTipo.setText("Tipo");

        local.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel5.setText("ID");

        tabelaequip.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "ID Equipamento", "Nome"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tabelaequip.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        tabelaequip.getTableHeader().setReorderingAllowed(false);
        jScrollPane2.setViewportView(tabelaequip);

        tabelaequip1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "ID Equipamento", "Nome"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tabelaequip1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        tabelaequip1.getTableHeader().setReorderingAllowed(false);
        jScrollPane4.setViewportView(tabelaequip1);

        jEquip.setText("Equipamentos Disponiveis");

        jEquipD.setText("Equipamentos no Laboratorio");

        adicionar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/arrow_right.png"))); // NOI18N
        adicionar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adicionarActionPerformed(evt);
            }
        });

        remover.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/arrow_left.png"))); // NOI18N
        remover.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removerActionPerformed(evt);
            }
        });

        tipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jPBancada.setText("Quantidade de Bancadas");

        jNBancada.setText("Quantidade por Bancada");

        addTipoLab.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/add.png"))); // NOI18N
        addTipoLab.setToolTipText("Clique aqui para inserir um novo tipo de Laboratório.");
        addTipoLab.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addTipoLabActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(7, 7, 7)
                        .add(jLabel5)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(idlab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 71, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(66, 66, 66)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jPanel1Layout.createSequentialGroup()
                                        .add(jLocal)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(local, 0, 195, Short.MAX_VALUE))
                                    .add(jPanel1Layout.createSequentialGroup()
                                        .add(jTipo)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                        .add(tipo, 0, 194, Short.MAX_VALUE)))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(addTipoLab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 38, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(125, 125, 125))
                            .add(jPBancada)
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(jNBancada)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(nbancada)
                                    .add(pbancada, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE))))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(jRemover, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                            .add(jInserir, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jEditar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .add(57, 57, 57))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 740, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                                .add(titulo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 190, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 276, Short.MAX_VALUE)
                                .add(juser)
                                .add(18, 18, 18)
                                .add(jiduser)
                                .add(158, 158, 158)))
                        .addContainerGap())
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jSeparator2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 740, Short.MAX_VALUE)
                        .addContainerGap())
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 740, Short.MAX_VALUE)
                        .addContainerGap())
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 266, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 81, Short.MAX_VALUE)
                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(adicionar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 64, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(remover, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 64, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(63, 63, 63))
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(jEquip)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jScrollPane4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 266, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jEquipD, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 240, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(titulo)
                    .add(juser, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jiduser))
                .add(8, 8, 8)
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                    .add(jLocal)
                                    .add(local, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                    .add(jTipo)
                                    .add(tipo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(addTipoLab)))
                            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                .add(jLabel5)
                                .add(idlab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jNBancada)
                            .add(pbancada, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jPBancada)
                            .add(nbancada, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(31, 31, 31)
                        .add(jInserir)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jEditar)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jRemover)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(8, 8, 8)
                .add(jScrollPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 152, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(32, 32, 32)
                        .add(adicionar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(remover, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jEquipD)
                            .add(jEquip, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 17, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(4, 4, 4)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 110, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jScrollPane4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 114, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .add(72, 72, 72))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 780, Short.MAX_VALUE)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .add(0, 0, Short.MAX_VALUE)
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(0, 0, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 593, Short.MAX_VALUE)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .add(0, 0, Short.MAX_VALUE)
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(0, 0, Short.MAX_VALUE)))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void tabelalabMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelalabMouseClicked
        // TODO add your handling code here:
        int linha=0;
        int coluna=0;

        linha = tabelalab.getSelectedRow();

        if(evt.getButton() == java.awt.event.MouseEvent.BUTTON1 && evt.getClickCount() == 2){
            poplab.show(tabelalab, evt.getX() , evt.getY());
            idLab = Integer.parseInt(tabelalab.getModel().getValueAt(linha, coluna).toString());
        }else{
            idLab = Integer.parseInt(tabelalab.getModel().getValueAt(linha, coluna).toString());
        }
}//GEN-LAST:event_tabelalabMouseClicked

    private void jRemoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRemoverActionPerformed
        // TODO add your handling code here:
        int idL = Integer.parseInt(idlab.getText());
        int j;


        if(idioma.equals("en_US")){
            Object[] options = {"Yes","No"};
            j = JOptionPane.showOptionDialog(null,
                            "Do you really want to edit this laboratory?",
                            "Edit Laboratory",
                            JOptionPane.YES_NO_OPTION,
                            JOptionPane.QUESTION_MESSAGE,
                            null,
                            options,
                            options[1]);
        }
        else{
            Object[] options = {"Sim","Não"};
            j = JOptionPane.showOptionDialog(null,
                            "Deseja realmente editar este laboratorio?",
                            "Editar Laboratorio",
                            JOptionPane.YES_NO_OPTION,
                            JOptionPane.QUESTION_MESSAGE,
                            null,
                            options,
                            options[1]);
            }
        if (j==JOptionPane.YES_OPTION){
            try{
                LabDAO labd = new LabDAO();
                ReservaDAO resdao = new ReservaDAO();
                EquipDAO equipd = new EquipDAO();
                List<Laboratorio> lista;
                List<Equipamento> lista1 = new ArrayList<Equipamento>();
                List<Equipamento> lista2;

                int ids[] = equipd.idsEquipLab(idL);

                for(int i=0;i<ids.length;i++){
                    equipd.removerEquipLab(ids[i]);
                    equipd.editarEquipStatus1(ids[i]);
                }

                labd.removerLab(idL);
                resdao.removerSolicLab(idL);

                lista = labd.labListar();
                lista2 = equipd.equipListarDispo();

                preencherTabela(lista);
                preencherEquipLab(lista1);
                preencherEquipDisponivel(lista2);

                idlab.setText("-");
                tipo.setSelectedIndex(0);
                local.setSelectedIndex(0);
                nbancada.setText("");
                pbancada.setText("");

                jRemover.setEnabled(false);
                jInserir.setEnabled(true);
                local.setEnabled(true);
                tipo.setEnabled(true);
                nbancada.setEditable(true);
                pbancada.setEditable(true);
                addTipoLab.setEnabled(true);
            } catch(SQLException ex){
                ex.printStackTrace();
            }
        }
}//GEN-LAST:event_jRemoverActionPerformed

    private void jEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jEditarActionPerformed
        // TODO add your handling code here:
        String localL = local.getSelectedItem().toString();
        String tipoL = tipo.getSelectedItem().toString();
        String nb = nbancada.getText();
        String pnb = pbancada.getText();

        Laboratorio lab = new Laboratorio();

        int idL = Integer.parseInt(idlab.getText());

        if(verificarNum(nb)==1 || verificarNum(pnb)==1){
            Main.log.info("O usuario: "+usuario+", inseriu valores invalidos.");
            if(idioma.equals("en_US")){
                JOptionPane.showMessageDialog(null, "All fields must be filled and with correct values!", "ERROR!", JOptionPane.ERROR_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(null, "Todos os campos devem ser preenchidos e com valores corretos!", "ERRO!", JOptionPane.ERROR_MESSAGE);
            }
        }else{
            int j;

            int nbancadaL = Integer.parseInt(nbancada.getText());
            int pbancadaL = Integer.parseInt(pbancada.getText());

            if(idioma.equals("en_US")){
                Object[] options = {"Yes","No"};
                j = JOptionPane.showOptionDialog(null,
                                "Do you really want to edit this laboratory?",
                                "Edit Laboratory",
                                JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE,
                                null,
                                options,
                                options[1]);
            }
            else{
                Object[] options = {"Sim","Não"};
                j = JOptionPane.showOptionDialog(null,
                                "Deseja realmente editar este laboratorio?",
                                "Editar Laboratorio",
                                JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE,
                                null,
                                options,
                                options[1]);
                }
            if (j==JOptionPane.YES_OPTION){
                try{
                    LabDAO labd = new LabDAO();
                    List<Laboratorio> lista;

                    lab.setIdlab(idL);
                    lab.setLocallab(localL);
                    lab.setNbancada(nbancadaL);
                    lab.setNporbancada(pbancadaL);
                    lab.setTipolab(tipoL);

                    labd.editarLab(lab);

                    lista = labd.labListar();

                    preencherTabela(lista);
                } catch(SQLException ex){
                    ex.printStackTrace();
                }
            }
            
        }
        
    }//GEN-LAST:event_jEditarActionPerformed

    private void jInserirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jInserirActionPerformed
        // TODO add your handling code here:

        String localL = local.getSelectedItem().toString();
        String tipoL = tipo.getSelectedItem().toString();
        String nb = nbancada.getText();
        String pnb = pbancada.getText();

        Laboratorio lab = new Laboratorio();

        if(verificarNum(nb)==1 || verificarNum(pnb)==1){
            Main.log.info("O usuario: "+usuario+", inseriu valores invalidos.");
            if(idioma.equals("en_US")){
                JOptionPane.showMessageDialog(null, "All fields must be filled and with correct values!", "ERROR!", JOptionPane.ERROR_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(null, "Todos os campos devem ser preenchidos e com valores corretos!", "ERRO!", JOptionPane.ERROR_MESSAGE);
            }
        }else{
            int nbancadaL = Integer.parseInt(nbancada.getText());
            int pbancadaL = Integer.parseInt(pbancada.getText());

            int j;
            
            if(idioma.equals("en_US")){
                Object[] options = {"Yes","No"};
                j = JOptionPane.showOptionDialog(null,
                                "Do you really want to insert this laboratory?",
                                "Insert Laboratory",
                                JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE,
                                null,
                                options,
                                options[1]);
            }
            else{
                Object[] options = {"Sim","Não"};
                j = JOptionPane.showOptionDialog(null,
                                "Deseja realmente inserir este laboratorio?",
                                "Inserir Laboratorio",
                                JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE,
                                null,
                                options,
                                options[1]);
                }
            if (j==JOptionPane.YES_OPTION){
               try{
                    LabDAO labd = new LabDAO();
                    List<Laboratorio> lista;

                    lab.setLocallab(localL);
                    lab.setNbancada(nbancadaL);
                    lab.setNporbancada(pbancadaL);
                    lab.setTipolab(tipoL);

                    labd.inserirLab(lab);
                    lista = labd.labListar();

                    preencherTabela(lista);
                } catch(SQLException ex){
                    ex.printStackTrace();
                } 
            }
        }
}//GEN-LAST:event_jInserirActionPerformed

    private void adicionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adicionarActionPerformed
        // TODO add your handling code here:
        int lin = tabelaequip.getSelectedRow();
        int col = tabelaequip.getSelectedColumn();

        if(lin<0 || col<0){
            System.out.println("erro");
        }else{
            int idEquip = Integer.parseInt(tabelaequip.getValueAt(lin, 0).toString());

            try{
                EquipDAO equipd = new EquipDAO();
                int ids[];
                int idL = Integer.parseInt(idlab.getText());
                List<Equipamento> lista1 = new ArrayList<Equipamento>();

                equipd.editarEquipStatus(idEquip);
                equipd.inserirEquipamentoLab(idL, idEquip);

                ids = equipd.idsEquipLab(idLab);

                for(int i=0;i<ids.length;i++){
                    lista1.add(equipd.equipLab(ids[i]));
                }

                preencherEquipLab(lista1);

                List<Equipamento> lista;

                lista = equipd.equipListarDispo();

                preencherEquipDisponivel(lista);
            }catch(SQLException e){
                e.printStackTrace();
            }
        }
    }//GEN-LAST:event_adicionarActionPerformed

    private void removerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removerActionPerformed
        // TODO add your handling code here:

        int lin = tabelaequip1.getSelectedRow();
        int col = tabelaequip1.getSelectedColumn();

        if(lin<0 || col<0){
            System.out.println("erro");
        }else{
            int idEquip = Integer.parseInt(tabelaequip1.getValueAt(lin, 0).toString());

            try{
                EquipDAO equipd = new EquipDAO();
                int ids[];
                int idL = Integer.parseInt(idlab.getText());
                List<Equipamento> lista;
                List<Equipamento> lista1 = new ArrayList<Equipamento>();

                equipd.editarEquipStatus1(idEquip);
                equipd.removerEquipLab(idEquip);

                lista = equipd.equipListarDispo();

                preencherEquipDisponivel(lista);

                ids = equipd.idsEquipLab(idL);

                for(int i=0;i<ids.length;i++){
                    lista1.add(equipd.equipLab(ids[i]));
                }

                preencherEquipLab(lista1);
                jEquipD.setText("Equipamentos no Laboratorio "+idL);
            }catch(SQLException e){
                e.printStackTrace();
            }
        }
}//GEN-LAST:event_removerActionPerformed

    private void jPanel1formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jPanel1formComponentShown
        // TODO add your handling code here:
    }//GEN-LAST:event_jPanel1formComponentShown

    private void jPanel1formComponentAdded(java.awt.event.ContainerEvent evt) {//GEN-FIRST:event_jPanel1formComponentAdded
        // TODO add your handling code here:
        idlab.setEditable(false);
        idlab.setText("-");
        jEditar.setEnabled(false);
        jRemover.setEnabled(false);
        adicionar.setEnabled(false);
        remover.setEnabled(false);
        tabelaequip.setEnabled(false);
        tabelaequip1.setEnabled(false);

        tabelaequip.getColumnModel().getColumn(0).setPreferredWidth(20);
        tabelaequip.getColumnModel().getColumn(1).setPreferredWidth(80);

        tabelaequip1.getColumnModel().getColumn(0).setPreferredWidth(20);
        tabelaequip1.getColumnModel().getColumn(1).setPreferredWidth(80);

        String[] combolocal;
        String[] combotipo;

        try{
            LocalDAO localx = new LocalDAO();
            TipoLabDAO tipox = new TipoLabDAO();

            combolocal = localx.comboLocal();
            combotipo = tipox.comboTipo();

            local.setModel(new javax.swing.DefaultComboBoxModel(combolocal));
            tipo.setModel(new javax.swing.DefaultComboBoxModel(combotipo));
        }
        catch(SQLException ex){
            ex.printStackTrace();
        }

        List<Laboratorio> lista;

        try{
            List<Equipamento> lista1;
            EquipDAO equipd = new EquipDAO();

            lista1 = equipd.equipListarDispo();

            preencherEquipDisponivel(lista1);
            LabDAO saladao = new LabDAO();

            lista = saladao.labListar();

            preencherTabela(lista);
        } catch(SQLException ex){
            ex.printStackTrace();
        }
}//GEN-LAST:event_jPanel1formComponentAdded

    private void inserirLabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inserirLabActionPerformed
        // TODO add your handling code here:

        jInserir.setEnabled(true);
        jEditar.setEnabled(false);
        jRemover.setEnabled(false);
        adicionar.setEnabled(false);
        remover.setEnabled(false);
        tabelaequip.setEnabled(false);
        tabelaequip1.setEnabled(false);
        local.setEnabled(true);
        tipo.setEnabled(true);
        addTipoLab.setEnabled(true);
        nbancada.setEditable(true);
        pbancada.setEditable(true);

        idlab.setText("-");
        tipo.setSelectedIndex(0);
        local.setSelectedIndex(0);
        nbancada.setText("");
        pbancada.setText("");
        
        try{
            List<Equipamento> lista1;
            EquipDAO equipd = new EquipDAO();

            lista1 = equipd.equipListarDispo();

            preencherEquipDisponivel(lista1);

            List<Equipamento> lista = new ArrayList<Equipamento>();
            preencherEquipLab(lista);

            jEquipD.setText("Equipamentos no Laboratorio");
        } catch(SQLException ex){
            ex.printStackTrace();
        }
    }//GEN-LAST:event_inserirLabActionPerformed

    private void editarLabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editarLabActionPerformed
        // TODO add your handling code here:
        jInserir.setEnabled(false);
        jEditar.setEnabled(true);
        jRemover.setEnabled(false);
        adicionar.setEnabled(false);
        remover.setEnabled(false);
        tabelaequip.setEnabled(false);
        tabelaequip1.setEnabled(false);
        local.setEnabled(true);
        tipo.setEnabled(true);
        addTipoLab.setEnabled(false);
        nbancada.setEditable(true);
        pbancada.setEditable(true);

        try{
            EquipDAO equipd = new EquipDAO();
            Laboratorio lab = new Laboratorio();
            LabDAO labd = new LabDAO();

            lab = labd.lab(idLab);

            idlab.setText(""+idLab);
            tipo.setSelectedItem(lab.getTipolab());
            local.setSelectedItem(lab.getLocallab());
            nbancada.setText(""+lab.getNbancada());
            pbancada.setText(""+lab.getNporbancada());

            List<Equipamento> lista1 = new ArrayList<Equipamento>();
            int idL = Integer.parseInt(idlab.getText());
            int ids[] = equipd.idsEquipLab(idL);

            for(int i=0;i<ids.length;i++){
                lista1.add(equipd.equipLab(ids[i]));
            }

            preencherEquipLab(lista1);

            jEquipD.setText("Equipamentos no Laboratorio "+idL);
        }catch(SQLException e){
            e.printStackTrace();
        }
}//GEN-LAST:event_editarLabActionPerformed

    private void removerLabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removerLabActionPerformed
        // TODO add your handling code here:
        jInserir.setEnabled(false);
        jEditar.setEnabled(false);
        jRemover.setEnabled(true);
        adicionar.setEnabled(false);
        remover.setEnabled(false);
        tabelaequip.setEnabled(false);
        tabelaequip1.setEnabled(false);
        local.setEnabled(false);
        tipo.setEnabled(false);
        addTipoLab.setEnabled(false);
        nbancada.setEditable(false);
        pbancada.setEditable(false);


        try{
            EquipDAO equipd = new EquipDAO();
            Laboratorio lab = new Laboratorio();
            LabDAO labd = new LabDAO();

            lab = labd.lab(idLab);

            idlab.setText(""+idLab);
            tipo.setSelectedItem(lab.getTipolab());
            local.setSelectedItem(lab.getLocallab());
            nbancada.setText(""+lab.getNbancada());
            pbancada.setText(""+lab.getNporbancada());
            
            List<Equipamento> lista1 = new ArrayList<Equipamento>();
            int idL = Integer.parseInt(idlab.getText());
            int ids[] = equipd.idsEquipLab(idL);

            for(int i=0;i<ids.length;i++){
                lista1.add(equipd.equipLab(ids[i]));
            }

            preencherEquipLab(lista1);
            jEquipD.setText("Equipamentos no Laboratorio "+idL);
        }catch(SQLException e){
            e.printStackTrace();
        }
}//GEN-LAST:event_removerLabActionPerformed

    private void equipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_equipActionPerformed
        // TODO add your handling code here:

        jInserir.setEnabled(false);
        jEditar.setEnabled(false);
        jRemover.setEnabled(false);
        adicionar.setEnabled(true);
        remover.setEnabled(true);
        tabelaequip.setEnabled(true);
        tabelaequip1.setEnabled(true);
        local.setEnabled(false);
        tipo.setEnabled(false);
        pbancada.setEditable(false);
        nbancada.setEditable(false);
        addTipoLab.setEnabled(false);

        int ids[];

        try{
            LabDAO labd = new LabDAO();
            Laboratorio lab = new Laboratorio();
            
            lab = labd.laboratorio(idLab);

            idlab.setText(""+lab.getIdlab());
            tipo.setSelectedItem(lab.getTipolab());
            local.setSelectedItem(lab.getLocallab());
            nbancada.setText(""+lab.getNbancada());
            pbancada.setText(""+lab.getNporbancada());
        }catch(SQLException e){
            e.printStackTrace();
        }

        try{
            List<Equipamento> lista;
            List<Equipamento> lista1 = new ArrayList<Equipamento>();
            EquipDAO equipd = new EquipDAO();

            lista = equipd.equipListarDispo();

            preencherEquipDisponivel(lista);

            int idL = Integer.parseInt(idlab.getText());
            ids = equipd.idsEquipLab(idLab);

            for(int i=0;i<ids.length;i++){
                lista1.add(equipd.equipLab(ids[i]));
            }

            preencherEquipLab(lista1);

            jEquipD.setText("Equipamentos no Laboratorio "+idL);
        }catch(SQLException e){
            e.printStackTrace();
        }
}//GEN-LAST:event_equipActionPerformed

    private void addTipoLabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTipoLabActionPerformed
        // TODO add your handling code here:
        String op;

        if(idioma.equals("en_US")){
            op = JOptionPane.showInputDialog(null, "Enter the new Laboratory type: ","New Laboratory Type", 1);
        }else{
            op = JOptionPane.showInputDialog(null, "Entre com o novo tipo de Laboratório: ","Novo Tipo de Laboratório", 1);
        }

        int j;

        if(op!=null || op.isEmpty()){
           if(idioma.equals("en_US")){
                Object[] options = {"Yes","No"};
                j = JOptionPane.showOptionDialog(null,
                                "Do you really want to add "+op+" as a type of Laboratory?",
                                "New Laboratory Type",
                                JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE,
                                null,
                                options,
                                options[1]);
            }
            else{
                Object[] options = {"Sim","Não"};
                j = JOptionPane.showOptionDialog(null,
                                "Deseja realmente adicionar "+op+" como um tipo de laboratório?",
                                "Novo Tipo de Laboratório",
                                JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE,
                                null,
                                options,
                                options[1]);
                }
            if (j==JOptionPane.YES_OPTION){

            }
        }
        
    }//GEN-LAST:event_addTipoLabActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addTipoLab;
    private javax.swing.JButton adicionar;
    private javax.swing.JMenuItem editarLab;
    private javax.swing.JMenuItem equip;
    private javax.swing.JTextField idlab;
    private javax.swing.JMenuItem inserirLab;
    private javax.swing.JButton jEditar;
    private javax.swing.JLabel jEquip;
    private javax.swing.JLabel jEquipD;
    private javax.swing.JButton jInserir;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLocal;
    private javax.swing.JLabel jNBancada;
    private javax.swing.JLabel jPBancada;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton jRemover;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JLabel jTipo;
    private javax.swing.JLabel jiduser;
    private javax.swing.JLabel juser;
    private javax.swing.JComboBox local;
    private javax.swing.JTextField nbancada;
    private javax.swing.JTextField pbancada;
    private javax.swing.JPopupMenu poplab;
    private javax.swing.JButton remover;
    private javax.swing.JMenuItem removerLab;
    private javax.swing.JTable tabelaequip;
    private javax.swing.JTable tabelaequip1;
    private javax.swing.JTable tabelalab;
    private javax.swing.JComboBox tipo;
    private javax.swing.JLabel titulo;
    // End of variables declaration//GEN-END:variables

    public void preencherTabela(List<Laboratorio> listalab){

        DefaultTableModel tabela = (DefaultTableModel) tabelalab.getModel();

        while (tabela.getRowCount() > 0) { //vai pegar todas as linha selecionadas maiores que zero, é vai remove-las!
            tabela.removeRow(0);
        }

        String[] linha = new String[]{null, null, null, null,null}; //colocando null em todas as colunas
        for (int i = 0; i < listalab.size(); i++) {
            tabela.addRow(linha);
            tabela.setValueAt(listalab.get(i).getIdlab(), i, 0);
            tabela.setValueAt(listalab.get(i).getNporbancada(), i, 1);
            tabela.setValueAt(listalab.get(i).getNbancada(), i, 2);
            tabela.setValueAt(listalab.get(i).getLocallab(), i, 3);
            tabela.setValueAt(listalab.get(i).getTipolab(), i, 4);
        }

    }

    public void preencherEquipDisponivel(List<Equipamento> lista){
        DefaultTableModel tabela = (DefaultTableModel) tabelaequip.getModel();

        while (tabela.getRowCount() > 0) { //vai pegar todas as linha selecionadas maiores que zero, é vai remove-las!
            tabela.removeRow(0);
        }

        String[] linha = new String[]{null, null}; //colocando null em todas as colunas
        for (int i = 0; i < lista.size(); i++) {
            tabela.addRow(linha);
            tabela.setValueAt(lista.get(i).getIdequip(), i, 0);
            tabela.setValueAt(lista.get(i).getNome(), i, 1);
        }

        descricao(lista);
    }

    public void preencherEquipLab(List<Equipamento> lista){
        DefaultTableModel tabela = (DefaultTableModel) tabelaequip1.getModel();

        while (tabela.getRowCount() > 0) { //vai pegar todas as linha selecionadas maiores que zero, é vai remove-las!
            tabela.removeRow(0);
        }

        String[] linha = new String[]{null, null}; //colocando null em todas as colunas
        for (int i = 0; i < lista.size(); i++) {
            tabela.addRow(linha);
            tabela.setValueAt(lista.get(i).getIdequip(), i, 0);
            tabela.setValueAt(lista.get(i).getNome(), i, 1);
        }

        descricao1(lista);
    }

    public void organizarHeaderLabs(){
        for(int i=0;i<5;i++){
            tabelalab.getTableHeader().setFont(new java.awt.Font(""+tabela[i],java.awt.Font.PLAIN, 11));
            tabelalab.getColumnModel().getColumn(i).setHeaderValue(""+tabela[i]);
        }
    }

    public void internacionaliza(){
        ResourceBundle palavras = ResourceBundle.getBundle("idiomas.Lingua_"+idioma);

        tabela[0] = "ID";
        tabela[1] = palavras.getString("gerenciarL.pbancada");
        tabela[2] = palavras.getString("gerenciarL.nbancada");
        tabela[3] = palavras.getString("gerenciarL.local");
        tabela[4] = palavras.getString("gerenciarL.tipo");
        
        juser.setText(palavras.getString("gerenciarL.user"));
        titulo.setText(palavras.getString("gerenciarL.titulo"));
        jLocal.setText(palavras.getString("gerenciarL.local"));
        jTipo.setText(palavras.getString("gerenciarL.tipo"));
        jNBancada.setText(palavras.getString("gerenciarL.nbancada"));
        jPBancada.setText(palavras.getString("gerenciarL.pbancada"));
        jEquip.setText(palavras.getString("gerenciarL.equipD"));
        jEquipD.setText(palavras.getString("gerenciarL.equip"));

        frase = palavras.getString("gerenciarL.equip");

        jInserir.setText(palavras.getString("gerenciarEquip.inserir"));
        jEditar.setText(palavras.getString("gerenciarEquip.editar"));
        jRemover.setText(palavras.getString("gerenciarEquip.remover"));
        juser.setText(palavras.getString("verificar.user"));
        inserirLab.setText(palavras.getString("gerenciarEquip.inserir"));
        editarLab.setText(palavras.getString("gerenciarEquip.editar"));
        removerLab.setText(palavras.getString("gerenciarEquip.remover"));
        equip.setText(palavras.getString("gerenciarS.equip"));

        eqp[0] = palavras.getString("sequipHeader.id");
        eqp[1] = palavras.getString("sequipHeader.nome");
    }

    public void descricao(final List<Equipamento> lista){
        tabelaequip.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(JTable table, Object value,
                    boolean isSelected, boolean hasFocus, int row, int column) {
                super.getTableCellRendererComponent(table, value, isSelected,
                        hasFocus, row, column);

                setToolTipText(lista.get(row).getDescricao());

                return this;
            }
        });
    }

    public void descricao1(final List<Equipamento> lista){
        tabelaequip1.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(JTable table, Object value,
                    boolean isSelected, boolean hasFocus, int row, int column) {
                super.getTableCellRendererComponent(table, value, isSelected,
                        hasFocus, row, column);

                setToolTipText(lista.get(row).getDescricao());

                return this;
            }
        });
    }

    public void organizarHeaderEquip(){
        for(int i=0;i<2;i++){
            tabelaequip.getTableHeader().setFont(new java.awt.Font(""+eqp[i],java.awt.Font.PLAIN, 11));
            tabelaequip.getColumnModel().getColumn(i).setHeaderValue(""+eqp[i]);
        }

        for(int i=0;i<2;i++){
            tabelaequip1.getTableHeader().setFont(new java.awt.Font(""+eqp[i],java.awt.Font.PLAIN, 11));
            tabelaequip1.getColumnModel().getColumn(i).setHeaderValue(""+eqp[i]);
        }
    }

     public int verificarNum(String lugares){

          Pattern p = Pattern.compile("[0123456789]{1,4}");

          Matcher m = p.matcher(lugares);

          boolean matchFound = m.matches();

          if (matchFound){
              return 0;
          }else{
              return 1;
          }
    }
}
